import { createRouter, createWebHistory , RouteRecordRaw } from "vue-router";
import settingRouter from './modules/setting'
import siteRouter from './modules/site'
import siteExample from './modules/example'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
const routes: Array<RouteRecordRaw> = [
  {
    path: "/login",
    name: "Login",
    component: () => import("../views/login/logIn.vue"),
    meta: {
      title: "登录",
    },
  },
  {
    path: "/home",
    name: "home",
    component: () => import("../views/Home.vue"),
    meta: {
      title: "概况",
    },
  },
];
routes.push(...settingRouter)
routes.push(...siteRouter)
routes.push(...siteExample) 
const router = createRouter({
  history: createWebHistory(),
  routes,
})

router.beforeEach((to, from, next) => {
  NProgress.start() // 进度条开始
  next()
})
 
router.afterEach(() => {
  NProgress.done() // 进度条结束
})

export default router;
